package com.primestone.cim.client.app.window;

import java.util.Calendar;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;

import ch.iec.tc57._2011.meterreadings.GetMeterReadings;
import ch.iec.tc57._2011.meterreadings.GetMeterReadingsPort;

import com.primestone.cim.util.StringUtil;
import com.primestone.cim.util.enums.MessageEnum;

/**
 * 
 * @author cesar.mateus
 * May 5, 2013 4:20:40 PM
 * CIMApplicationWindow.java
 * CIMClientApplication
 *
 */
public class CIMApplicationWindow {

	private Shell shlCimClientApplication;
	private Display display;
	private Table table;

	private DateTime iniDate;
	private DateTime endDate;

	private ProgressBar pb1;

	private Text socketOrDeviceText;
	private Text varText;
	private Text error;

	private Label lblSocket;
	private Label lblVariable;
	
	private Button btnEvents;
	private Button btnSocket;
	private Button btnDevice;
	private Button btnOnlyNew;
	private Button btnMassmemory;
	private Button btnRegisters;

	private Spinner spinnerTop;
	
	
	//FileSelectionDialog a;

	//private static Pattern pattern = Pattern.compile("\n");
	private static GetMeterReadingsPort port1;
	private static boolean port1Up = false;
	private static String errorMsg;
	
	private static boolean processStarted = false;
	
	
	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {

		try {
			createPort();
			port1Up = true;
		} catch (Exception e) {
			e.printStackTrace();
			errorMsg = e.getMessage();
		}

		CIMApplicationWindow window = new CIMApplicationWindow();
		window.open();

	}

	/**
	 * Open the window.
	 */
	public void open() {
		setDisplay(Display.getDefault());
		
		setShlCimClientApplication(new Shell(getDisplay()));
		getShlCimClientApplication().setToolTipText(Messages.getString("CIMApplicationWindow.0")); //$NON-NLS-1$
		getShlCimClientApplication().setSize(1000, 520);
		getShlCimClientApplication().setText(Messages.getString("CIMApplicationWindow.1")); //$NON-NLS-1$

		center(getShlCimClientApplication());
		
		createContents();
		
		getShlCimClientApplication().open();
		getShlCimClientApplication().layout();
		
		while (!getShlCimClientApplication().isDisposed()) {
			if (!getDisplay().readAndDispatch()) {
				getDisplay().sleep();
			}
		}
		//getDisplay().dispose();
	}

	private static void center(Shell shell) {
		Rectangle bds = shell.getMonitor().getBounds();
		Point p = shell.getSize();
		int nLeft = (bds.width - p.x) / 2;
		int nTop = (bds.height - p.y) / 2;
		shell.setBounds(nLeft, nTop, p.x, p.y);
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {

		setPb1(new ProgressBar(getShlCimClientApplication(), SWT.HORIZONTAL | SWT.SMOOTH));
		getPb1().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		getPb1().setMinimum(0);
		getPb1().setMaximum(100);

		setIniDate(new DateTime(getShlCimClientApplication(), SWT.BORDER | SWT.DROP_DOWN));
		getIniDate().setBounds(10, 73, 141, 24);
		getIniDate().setDate(Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH);
		//getIniDate().setDate(2009, Calendar.JULY, 01);

		setEndDate(new DateTime(getShlCimClientApplication(), SWT.BORDER | SWT.DROP_DOWN));
		getEndDate().setEnabled(false);
		getEndDate().setBounds(157, 73, 142, 24);
		getEndDate().setDate(3000, 01, 01);

		setBtnMassmemory(new Button(getShlCimClientApplication(), SWT.CHECK));
		getBtnMassmemory().setBounds(47, 109, 93, 16);
		getBtnMassmemory().setText(Messages.getString("CIMApplicationWindow.2")); //$NON-NLS-1$
		getBtnMassmemory().setSelection(true);

		setBtnRegisters(new Button(getShlCimClientApplication(), SWT.CHECK));
		getBtnRegisters().setBounds(157, 109, 67, 16);
		getBtnRegisters().setText(Messages.getString("CIMApplicationWindow.3")); //$NON-NLS-1$

		setBtnEvents(new Button(getShlCimClientApplication(), SWT.CHECK));		
		getBtnEvents().setText(Messages.getString("CIMApplicationWindow.4")); //$NON-NLS-1$
		getBtnEvents().setBounds(244, 109, 55, 16);

		setBtnSocket(new Button(getShlCimClientApplication(), SWT.RADIO));
		getBtnSocket().setBounds(349, 49, 61, 16);
		getBtnSocket().setText(Messages.getString("CIMApplicationWindow.5")); //$NON-NLS-1$

		setBtnDevice(new Button(getShlCimClientApplication(), SWT.RADIO));
		getBtnDevice().setSelection(true);
		getBtnDevice().setBounds(416, 49, 58, 16);
		getBtnDevice().setText(Messages.getString("CIMApplicationWindow.6")); //$NON-NLS-1$

		Button btnIniciar = new Button(getShlCimClientApplication(), SWT.PUSH);
		btnIniciar.setImage(SWTResourceManager.getImage(CIMApplicationWindow.class, Messages.getString("CIMApplicationWindow.7"))); //$NON-NLS-1$
		btnIniciar.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				if (port1Up) {
					validateInputUser();
					if (!StringUtil.safe(getError().getText())) {
						new LongRunningOperation(new LongRunningOperationParam(CIMApplicationWindow.this), LongRunningOperation.Options.ALL_PROCESS, port1, getDisplay(), getTable(), getError()).start();	
					}
				} else {
					getError().setText(Messages.getString("CIMApplicationWindow.8") + (errorMsg != null && errorMsg.length() > 0 ? errorMsg : Messages.getString("CIMApplicationWindow.9")) ); //$NON-NLS-1$ //$NON-NLS-2$
				}
			}
		});

		btnIniciar.setBounds(10, 5, 75, 25);

		setTable(new Table(getShlCimClientApplication(), SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI));
		getTable().setBounds(10, 161, 964, 219);
		getTable().setLinesVisible(true);

		Label lblFechaInicio = new Label(getShlCimClientApplication(), SWT.NONE);
		lblFechaInicio.setBounds(10, 49, 67, 15);
		lblFechaInicio.setText(Messages.getString("CIMApplicationWindow.10")); //$NON-NLS-1$

		Label lblFechaFin = new Label(getShlCimClientApplication(), SWT.NONE);
		lblFechaFin.setBounds(157, 49, 55, 15);
		lblFechaFin.setText(Messages.getString("CIMApplicationWindow.11")); //$NON-NLS-1$

		setSocketOrDeviceText(new Text(getShlCimClientApplication(), SWT.BORDER));
		getSocketOrDeviceText().setBounds(444, 73, 141, 21);
		//getSocketOrDeviceText().setText("53026972");

		setLblSocket(new Label(getShlCimClientApplication(), SWT.NONE));
		getLblSocket().setBounds(349, 73, 89, 15);
		getLblSocket().setText(Messages.getString("CIMApplicationWindow.12")); //$NON-NLS-1$

		setLblVariable(new Label(getShlCimClientApplication(), SWT.NONE));
		getLblVariable().setBounds(393, 110, 45, 15);
		getLblVariable().setText(Messages.getString("CIMApplicationWindow.13")); //$NON-NLS-1$

		setVarText(new Text(getShlCimClientApplication(), SWT.BORDER));
		getVarText().setBounds(444, 110, 142, 21);

		setError(new Text(getShlCimClientApplication(), SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI));
		getError().setBounds(10, 385, 964, 65);
		if (!port1Up) {
			getError().setText(Messages.getString("CIMApplicationWindow.14") + (errorMsg != null && errorMsg.length() > 0 ? errorMsg : Messages.getString("CIMApplicationWindow.15")) ); //$NON-NLS-1$ //$NON-NLS-2$
		} else {
			getError().setText(Messages.getString("CIMApplicationWindow.16") ); //$NON-NLS-1$
		}

		Label label = new Label(getShlCimClientApplication(), SWT.SEPARATOR | SWT.VERTICAL);
		label.setBounds(326, 40, 2, 101);

		Menu menu = new Menu(getShlCimClientApplication(), SWT.BAR);

		MenuItem mntmFile = new MenuItem(menu, SWT.CASCADE);
		mntmFile.setText(Messages.getString("CIMApplicationWindow.17")); //$NON-NLS-1$

		Menu fileMenu = new Menu(getShlCimClientApplication(), SWT.DROP_DOWN);
		mntmFile.setMenu(fileMenu);

		MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH);
		exitItem.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				getShlCimClientApplication().getDisplay().dispose();
				getShlCimClientApplication().dispose();
				System.exit(0);
			}
		});
		exitItem.setText(Messages.getString("CIMApplicationWindow.18")); //$NON-NLS-1$

		MenuItem mntmMore = new MenuItem(menu, SWT.CASCADE);
		mntmMore.setText(Messages.getString("CIMApplicationWindow.19")); //$NON-NLS-1$

		Menu moreMenu = new Menu(getShlCimClientApplication(), SWT.DROP_DOWN);
		mntmMore.setMenu(moreMenu);

		MenuItem cleanItem = new MenuItem(moreMenu, SWT.PUSH);
		cleanItem.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				getTable().clearAll();
				getError().setText(StringUtil.EMPTY);
			}
		});
		cleanItem.setText(Messages.getString("CIMApplicationWindow.20")); //$NON-NLS-1$

		getShlCimClientApplication().setMenuBar(menu);

		Label label_1 = new Label(getShlCimClientApplication(), SWT.SEPARATOR | SWT.HORIZONTAL);
		label_1.setBounds(10, 32, 964, 11);

		setSpinnerTop(new Spinner(getShlCimClientApplication(), SWT.BORDER));
		getSpinnerTop().setTextLimit(5);
		getSpinnerTop().setMaximum(10000);
		getSpinnerTop().setMinimum(10);
		getSpinnerTop().setSelection(1000);
		getSpinnerTop().setBounds(657, 73, 67, 22);

		setBtnOnlyNew(new Button(getShlCimClientApplication(), SWT.CHECK));
		getBtnOnlyNew().setBounds(649, 49, 75, 16);
		getBtnOnlyNew().setText(Messages.getString("CIMApplicationWindow.21")); //$NON-NLS-1$

		Label lblTop = new Label(getShlCimClientApplication(), SWT.NONE);
		lblTop.setBounds(618, 73, 33, 15);
		lblTop.setText(Messages.getString("CIMApplicationWindow.22")); //$NON-NLS-1$

		Label label_2 = new Label(getShlCimClientApplication(), SWT.SEPARATOR | SWT.HORIZONTAL);
		label_2.setBounds(10, 144, 964, 11);

		final LongRunningOperation longRunningOperation = new LongRunningOperation();

		final Button buttonFirstStep = new Button(getShlCimClientApplication(), SWT.NONE);
		buttonFirstStep.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				if (port1Up) {
					LongRunningOperationParam param = new LongRunningOperationParam(CIMApplicationWindow.this);
	
					longRunningOperation.setDisplay(getDisplay());
					//longRunningOperation.setProgressBar(progressBar) Calcularla dentro.
					longRunningOperation.setVartypeRequest(param.getVartypeRequest());
					longRunningOperation.setPort1(port1);
					longRunningOperation.setYearIni(param.getYearIni());
					longRunningOperation.setYearEnd(param.getYearEnd());
					longRunningOperation.setDayIni(param.getDayIni());
					longRunningOperation.setDayEnd(param.getDayEnd());
					longRunningOperation.setMonthIni(param.getMonthIni());
					longRunningOperation.setMonthEnd(param.getMonthEnd());
					longRunningOperation.setM(param.isM());
					longRunningOperation.setR(param.isR());
					longRunningOperation.setV(param.isV());
					longRunningOperation.setOnlyNew(param.isOnlyNew());
					longRunningOperation.setDescVar(param.getDescvar());
					longRunningOperation.setSocket(param.getSocket());
					longRunningOperation.setDevice(param.getDevice());
					longRunningOperation.setTop(param.getTop());
					longRunningOperation.setTable(getTable());
					longRunningOperation.setError(getError());
					longRunningOperation.setProcessType(LongRunningOperation.Options.INITIAL_REQUEST);
					
					validateInputUser();
					if (!StringUtil.safe(getError().getText())) {
						longRunningOperation.start();
						processStarted = true;
					}
				} else {
					getError().setText(Messages.getString("CIMApplicationWindow.23") + (errorMsg != null && errorMsg.length() > 0 ? errorMsg : Messages.getString("CIMApplicationWindow.24")) ); //$NON-NLS-1$ //$NON-NLS-2$
				}

			}
		});
		buttonFirstStep.setImage(SWTResourceManager.getImage(CIMApplicationWindow.class, Messages.getString("CIMApplicationWindow.25"))); //$NON-NLS-1$
		buttonFirstStep.setBounds(91, 5, 75, 25);

		Button buttonNextStep = new Button(getShlCimClientApplication(), SWT.NONE);
		
		buttonNextStep.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				if (port1Up) {
//					LongRunningOperation longRunningOperationNext = new LongRunningOperation();
					if (processStarted && longRunningOperation.getPort1() != null && !StringUtil.safe(getError().getText())) {
						
//						longRunningOperationNext.setOriginalLongRunningOperation(longRunningOperation);
//						
//						longRunningOperationNext.setDisplay(longRunningOperation.getDisplay());
//						//longRunningOperationNext.setProgressBar(progressBar) Calcularla dentro.
//						longRunningOperationNext.setPort1(longRunningOperation.getPort1());
//						longRunningOperationNext.setDescVar(longRunningOperation.getDescVar());
//						longRunningOperationNext.setSocket(longRunningOperation.getSocket());
//						longRunningOperationNext.setDevice(longRunningOperation.getDevice());
//						longRunningOperationNext.setTop(longRunningOperation.getTop());
//						longRunningOperationNext.setTable(longRunningOperation.getTable());
//						longRunningOperationNext.setError(longRunningOperation.getError());
//
//						longRunningOperationNext.setTicket(longRunningOperation.getTicket());
//						longRunningOperationNext.setIdBlock(longRunningOperation.getIdBlock());
//						
//						System.out.println(Messages.getString("CIMApplicationWindow.26") + longRunningOperationNext.getIdBlock()); //$NON-NLS-1$
//						System.out.println(Messages.getString("CIMApplicationWindow.27") + longRunningOperationNext.getOriginalLongRunningOperation().getIdBlock()); //$NON-NLS-1$
//						System.out.println(Messages.getString("CIMApplicationWindow.28") + longRunningOperation.getIdBlock()); //$NON-NLS-1$
//						
//						longRunningOperationNext.setWriter(longRunningOperation.getWriter());
//
//						longRunningOperationNext.setProcessType(LongRunningOperation.Options.NEXT);
						

						longRunningOperation.nextRequest();
					}

//					validateInputUser();
//					if (!StringUtil.safe(getError().getText())) {
//						longRunningOperationNext.start();
//						processStarted = true;
//					}
				} else {
					getError().setText(Messages.getString("CIMApplicationWindow.29") + (errorMsg != null && errorMsg.length() > 0 ? errorMsg : Messages.getString("CIMApplicationWindow.30")) ); //$NON-NLS-1$ //$NON-NLS-2$
				}
			}
		});
		buttonNextStep.setImage(SWTResourceManager.getImage(CIMApplicationWindow.class, Messages.getString("CIMApplicationWindow.31"))); //$NON-NLS-1$
		buttonNextStep.setBounds(172, 5, 75, 25);
		
		Button buttonAllNextSteps = new Button(getShlCimClientApplication(), SWT.NONE);
		buttonAllNextSteps.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				
				LongRunningOperation longRunningOperationAllNext = new LongRunningOperation();
				if (processStarted && longRunningOperation.getPort1() != null && !StringUtil.safe(getError().getText())) {
					longRunningOperationAllNext.setDisplay(longRunningOperation.getDisplay());
					//longRunningOperationNext.setProgressBar(progressBar) Calcularla dentro.
					longRunningOperationAllNext.setPort1(longRunningOperation.getPort1());
					longRunningOperationAllNext.setDescVar(longRunningOperation.getDescVar());
					longRunningOperationAllNext.setSocket(longRunningOperation.getSocket());
					longRunningOperationAllNext.setDevice(longRunningOperation.getDevice());
					longRunningOperationAllNext.setTop(longRunningOperation.getTop());
					longRunningOperationAllNext.setTable(longRunningOperation.getTable());
					longRunningOperationAllNext.setError(longRunningOperation.getError());

					longRunningOperationAllNext.setTicket(longRunningOperation.getTicket());
					longRunningOperationAllNext.setIdBlock(longRunningOperation.getIdBlock());
					longRunningOperationAllNext.setLastBlock(longRunningOperation.isLastBlock());
					longRunningOperationAllNext.setWriter(longRunningOperation.getWriter());

					longRunningOperationAllNext.setProcessType(LongRunningOperation.Options.ALL_NEXT);
				}

				validateInputUser();
				if (!StringUtil.safe(getError().getText())) {
					longRunningOperationAllNext.start();
					processStarted = true;
				}
				
//				validateInputUser();
				
//				if (processStarted && longRunningOperation.getPort1() != null && !StringUtil.safe(getError().getText())) {
//					longRunningOperation.nextAllRequest();
//				}
			}
		});
		buttonAllNextSteps.setImage(SWTResourceManager.getImage(CIMApplicationWindow.class, Messages.getString("CIMApplicationWindow.32"))); //$NON-NLS-1$
		buttonAllNextSteps.setBounds(253, 5, 75, 25);
		getShlCimClientApplication().setTabList(new Control[]{iniDate, endDate, btnMassmemory, btnRegisters, btnEvents, btnSocket, btnDevice, socketOrDeviceText, varText, btnOnlyNew, spinnerTop, buttonFirstStep, buttonNextStep, buttonAllNextSteps, btnIniciar, table, error, pb1});

	}
	
	private void validateInputUser() {
		// TODO descomentar esto!!
		if (!getBtnMassmemory().getSelection() && !getBtnRegisters().getSelection() && !getBtnEvents().getSelection()) {
			getError().setText(MessageEnum.INCOMPLETE_REQUEST_VARTYPE.getDescription());
		} else if (!StringUtil.safe(getSocketOrDeviceText().getText())) {
			getError().setText(MessageEnum.INCOMPLETE_REQUEST_SOCKET_OR_DEVICE.getDescription());
		} else {
			getError().setText(StringUtil.EMPTY);
		}
	}

	private static void createPort() {
		GetMeterReadings service1 = new GetMeterReadings();
		System.out.println(Messages.getString("CIMApplicationWindow.33")); //$NON-NLS-1$
		port1 = service1.getGetMeterReadingsPort();
	}

	/**
	 * @return the shlCimClientApplication
	 */
	public Shell getShlCimClientApplication() {
		return this.shlCimClientApplication;
	}

	/**
	 * @param shlCimClientApplication the shlCimClientApplication to set
	 */
	public void setShlCimClientApplication(Shell shlCimClientApplication) {
		this.shlCimClientApplication = shlCimClientApplication;
	}

	/**
	 * @return the table
	 */
	public Table getTable() {
		return this.table;
	}

	/**
	 * @param table the table to set
	 */
	public void setTable(Table table) {
		this.table = table;
		table.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_HAND));
		table.setHeaderVisible(true);
	}

	/**
	 * @return the iniDate
	 */
	public DateTime getIniDate() {
		return this.iniDate;
	}

	/**
	 * @param iniDate the iniDate to set
	 */
	public void setIniDate(DateTime iniDate) {
		this.iniDate = iniDate;
	}

	/**
	 * @return the endDate
	 */
	public DateTime getEndDate() {
		return this.endDate;
	}

	/**
	 * @param endDate the endDate to set
	 */
	public void setEndDate(DateTime endDate) {
		this.endDate = endDate;
	}

	/**
	 * @return the pb1
	 */
	public ProgressBar getPb1() {
		return this.pb1;
	}

	/**
	 * @param pb1 the pb1 to set
	 */
	public void setPb1(ProgressBar pb1) {
		this.pb1 = pb1;
	}

	/**
	 * @return the socketOrDeviceText
	 */
	public Text getSocketOrDeviceText() {
		return this.socketOrDeviceText;
	}

	/**
	 * @param socketOrDeviceText the socketOrDeviceText to set
	 */
	public void setSocketOrDeviceText(Text socketOrDeviceText) {
		this.socketOrDeviceText = socketOrDeviceText;
	}

	/**
	 * @return the varText
	 */
	public Text getVarText() {
		return this.varText;
	}

	/**
	 * @param varText the varText to set
	 */
	public void setVarText(Text varText) {
		this.varText = varText;
	}

	/**
	 * @return the error
	 */
	public Text getError() {
		return this.error;
	}

	/**
	 * @param error the error to set
	 */
	public void setError(Text error) {
		this.error = error;
	}

	/**
	 * @return the lblSocket
	 */
	public Label getLblSocket() {
		return this.lblSocket;
	}

	/**
	 * @param lblSocket the lblSocket to set
	 */
	public void setLblSocket(Label lblSocket) {
		this.lblSocket = lblSocket;
	}

	/**
	 * @return the lblVariable
	 */
	public Label getLblVariable() {
		return this.lblVariable;
	}

	/**
	 * @param lblVariable the lblVariable to set
	 */
	public void setLblVariable(Label lblVariable) {
		this.lblVariable = lblVariable;
	}

	/**
	 * @return the btnEvents
	 */
	public Button getBtnEvents() {
		return this.btnEvents;
	}

	/**
	 * @param btnEvents the btnEvents to set
	 */
	public void setBtnEvents(Button btnEvents) {
		this.btnEvents = btnEvents;
	}

	/**
	 * @return the btnSocket
	 */
	public Button getBtnSocket() {
		return this.btnSocket;
	}

	/**
	 * @param btnSocket the btnSocket to set
	 */
	public void setBtnSocket(Button btnSocket) {
		this.btnSocket = btnSocket;
	}

	/**
	 * @return the btnDevice
	 */
	public Button getBtnDevice() {
		return this.btnDevice;
	}

	/**
	 * @param btnDevice the btnDevice to set
	 */
	public void setBtnDevice(Button btnDevice) {
		this.btnDevice = btnDevice;
	}

	/**
	 * @return the btnOnlyNew
	 */
	public Button getBtnOnlyNew() {
		return this.btnOnlyNew;
	}

	/**
	 * @param btnOnlyNew the btnOnlyNew to set
	 */
	public void setBtnOnlyNew(Button btnOnlyNew) {
		this.btnOnlyNew = btnOnlyNew;
	}

	/**
	 * @return the btnMassmemory
	 */
	public Button getBtnMassmemory() {
		return this.btnMassmemory;
	}

	/**
	 * @param btnMassmemory the btnMassmemory to set
	 */
	public void setBtnMassmemory(Button btnMassmemory) {
		this.btnMassmemory = btnMassmemory;
	}

	/**
	 * @return the btnRegisters
	 */
	public Button getBtnRegisters() {
		return this.btnRegisters;
	}

	/**
	 * @param btnRegisters the btnRegisters to set
	 */
	public void setBtnRegisters(Button btnRegisters) {
		this.btnRegisters = btnRegisters;
	}

	/**
	 * @return the spinnerTop
	 */
	public Spinner getSpinnerTop() {
		return this.spinnerTop;
	}

	/**
	 * @param spinnerTop the spinnerTop to set
	 */
	public void setSpinnerTop(Spinner spinnerTop) {
		this.spinnerTop = spinnerTop;
	}

	/**
	 * @return the display
	 */
	public Display getDisplay() {
		return this.display;
	}



	/**
	 * @param display the display to set
	 */
	public void setDisplay(Display display) {
		this.display = display;
	}
}